import request from "@/utils/request";
import type { LoginParams, LoginResult } from "./types";
import { Permission } from "@/stores/userStore";

// 登录
export const login = (data: LoginParams) => {
  return request.post<LoginResult>("/login", data, {
    showSuccess: true,
    successMessage: "登录成功",
  });
};

interface UserInfo { 
  routes: Permission[];
}

export const getUserPermission = () => {
  return request.get<UserInfo>("/user/info");
};
